package com.atkxp.service.impl;

import com.atkxp.dao.impl.UserDaoImpl;
import com.atkxp.domain.User;
import com.atkxp.service.UserService;

/**
 * @author user
 * @declaration
 * @create 2022/9/17-10:14
 */
public class UserServiceImpl implements UserService {

    private UserDaoImpl userDao = new UserDaoImpl();
    @Override
    public void registUser(User user) {
        userDao.savaUser(user);
    }

    @Override
    public User login(User user) {
        return userDao.queryWithUsernameAndPassword(user.getUsername(), user.getPassword());
    }

    @Override
    public boolean existUsername(String username) {
        if(userDao.queryWithUsername(username) == null){
            return false;
        }
        return true;
    }
}
